/**
* js class function for 
* param {object |date} today
* param {object|date} party day of the event
* param {string|date} id some identification string for the html elements
* return {string} json date object
*/
webCountdown = function (today,party,id){
    var text = ''; 
    
    // check and assing date objects  
    if (!today.getDay) today = new Date(today['year'],today['month'],today['day'],today['hour'],today['min'],today['sec']).getTime();
    if (!party.getDay) party = new Date(party['year'],party['month'],party['day'],party['hour'],party['min'],party['sec']).getTime();
    
    var curTime = party-today;
    var oldDay = false;
    var dayEl, timeEl;

    dayEl=document.getElementById('countDownClockDays'+id); 
    timeEl=document.getElementById('countDownClockTime'+id); 

    return {
	// function called every time interval (second)
	actualize: function() { 
	    curTime -= 1000;
	    var curDay = Math.floor(curTime/(1000*60*60*24));
	    var curHour = Math.floor((curTime - curDay*(1000*60*60*24))/(1000*60*60));
	    var curMin = Math.floor((curTime - curHour*(1000*60*60) - curDay*(1000*60*60*24))/(1000*60));
	    var curSec = Math.floor((curTime - curMin*(1000*60) - curHour*(1000*60*60) - curDay*(1000*60*60*24))/(1000));
	    if (oldDay!=curDay) dayEl.innerHTML = curDay;
	    timeEl.innerHTML = curHour + ' h. ' + curMin+ ' m. ' + curSec + ' s.';
	    oldDay = curDay;
	}
    }
}
